using System;
using System.Collections.Generic;
using System.Text;

namespace SocketForm
{
   public class MainServer
    {
        private TcpServer tcpserver = null;
     
        private string ServerIP = null;
        private int ServerPort = 0;
    
       // private pluginMgr[] plugins = null;
       // public string serviceType = "";
       
        public MainForm m_form = null;
        public DateTime newTime = new DateTime(2010, 1, 1, 1, 1, 1);
        
        public MainServer(string IP,int Port,MainForm m)
        {
           
            ServerIP = IP;
            ServerPort = Port;
            this.m_form = m;
           
        }
        public void start()
        {
            tcpserver = new TcpServer(this, this.ServerIP, this.ServerPort);                
            tcpserver.start();
           
        }
        public void stop()
        {  
            tcpserver.stop();
                      
        }

       public void setConnectInfo(string remoteIP, string remotePort, System.Net.Sockets.TcpClient client, string msg)
        {
            m_form.setConnectInfo(remoteIP + ":" + remotePort, client, msg);
        }

        public void outErrMsg(string p)
        {
            m_form.showerr(p);
        }
    }
}
